/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package edu.cmu.mism.dgjava.data.models.option.impl;

import edu.cmu.mism.dgjava.data.models.option.AmericanType;
import edu.cmu.mism.dgjava.data.models.option.OptionModelPackage;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.impl.ENotificationImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>American Type</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link edu.cmu.mism.dgjava.data.models.option.impl.AmericanTypeImpl#getTimeToExpire <em>Time To Expire</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class AmericanTypeImpl extends PricingModelImpl implements AmericanType {
	/**
	 * The default value of the '{@link #getTimeToExpire() <em>Time To Expire</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getTimeToExpire()
	 * @generated
	 * @ordered
	 */
	protected static final double TIME_TO_EXPIRE_EDEFAULT = 0.0;
	/**
	 * The cached value of the '{@link #getTimeToExpire() <em>Time To Expire</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getTimeToExpire()
	 * @generated
	 * @ordered
	 */
	protected double timeToExpire = TIME_TO_EXPIRE_EDEFAULT;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected AmericanTypeImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return OptionModelPackage.Literals.AMERICAN_TYPE;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public double getTimeToExpire() {
		return timeToExpire;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setTimeToExpire(double newTimeToExpire) {
		double oldTimeToExpire = timeToExpire;
		timeToExpire = newTimeToExpire;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, OptionModelPackage.AMERICAN_TYPE__TIME_TO_EXPIRE, oldTimeToExpire, timeToExpire));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case OptionModelPackage.AMERICAN_TYPE__TIME_TO_EXPIRE:
				return getTimeToExpire();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case OptionModelPackage.AMERICAN_TYPE__TIME_TO_EXPIRE:
				setTimeToExpire((Double)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case OptionModelPackage.AMERICAN_TYPE__TIME_TO_EXPIRE:
				setTimeToExpire(TIME_TO_EXPIRE_EDEFAULT);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case OptionModelPackage.AMERICAN_TYPE__TIME_TO_EXPIRE:
				return timeToExpire != TIME_TO_EXPIRE_EDEFAULT;
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (timeToExpire: ");
		result.append(timeToExpire);
		result.append(')');
		return result.toString();
	}

} //AmericanTypeImpl
